import React from 'react';
import {configureChains, createConfig, WagmiConfig} from 'wagmi';
import {mainnet, sepolia} from 'wagmi/chains'
import {publicProvider} from 'wagmi/providers/public';
import {alchemyProvider} from "wagmi/providers/alchemy";

import {MetaMaskConnector} from 'wagmi/connectors/metaMask';
import {InjectedConnector} from 'wagmi/connectors/injected';

import {CoinbaseWalletConnector} from 'wagmi/connectors/coinbaseWallet';
import {WalletConnectConnector} from 'wagmi/connectors/walletConnect';
import {useModel} from "umi";


export default function WalletProvider({children}: any) {

    const {inj, publicClient} = useModel('user')
    const config = createConfig({
        autoConnect: true,
        connectors: [inj],
        publicClient,
    })
    return <WagmiConfig config={config}>{children}</WagmiConfig>;
}
